<?php include $this->admin_tpl('meta', 'admin');?>
<title>选择文章 - YzmCMS内容管理系统</title>
</head>
<body>
<div class="page-container">
  <div> 
    <form action="<?php echo U(ROUTE_A);?>" method="get" id="search">
    	<input type="hidden" value="<?php echo 	ROUTE_M?>" name="m">
    	<input type="hidden" value="<?php echo 	ROUTE_C?>" name="c">
    	<input type="hidden" value="<?php echo 	ROUTE_A?>" name="a">
    	<span class="select-box inline"><?php echo select_category('catid', $catid, '不限栏目', 0, '', true, true, $wx_relation_model); ?></span>
		 更新时间：<input type="text" class="input-text laydate-icon" style="width:110px;height:30px;" id="start" name="start" <?php if(isset($_GET['start']) && $_GET['start'] != '') echo 'value="'.$_GET['start'].'"'; ?>>
     至 <input type="text" class="input-text laydate-icon" style="width:110px;height:30px;" id="end" name="end" value="<?php if(isset($_GET['end']) &&  $_GET['end'] != '') echo $_GET['end']; else echo date('Y-m-d'); ?>">    	
    内容标题：
     <input type="text" name="searinfo" class="input-text" style="width:180px" value="<?php if(isset($_GET['searinfo'])) echo $_GET['searinfo'];?>"><button name="dosubmit" class="btn btn-success" type="submit" value="1"><i class="yzm-iconfont yzm-iconsousuo"></i> 搜索</button> 
	 </form>	
  </div>
  <form method="post" action="" id="myform">
  <table class="table table-border table-bg table-hover mt-10">
    <thead>
      <tr class="text-c">
        <th width="25"><input type="checkbox"></th>
		<th width="40">ID</th>
		<th>标题</th>
		<th>内容分类</th>
		<th>更新时间</th>
      </tr>
    </thead>
    <tbody>
		<?php 
		foreach($data as $val){
		?>
		  <tr class="text-c">
			<td><input type="checkbox" value="<?php echo $val['id']?>" name="ids[]"></td>
			<td><?php echo $val['id']?></td>
			<td class="text-l">
			<?php 
			if($val['thumb']){
				echo '<span style="color:#0a6999;font-size:14px;vertical-align:middle;" onmouseover="yzm_img_browse(this, \''.$val['thumb'].'\')" onmouseout="layer.closeAll(\'tips\')" class="yzm-iconfont yzm-icontupian1 pointer"></span>';
			}
			?>
			<a href="<?php echo $val['url'];?>" target="_blank" ><?php echo $val['title'];?></a>
			<?php
			if(strpos($val['flag'], '1') !== false){
				echo '<span class="yzm-font-style" title="置顶">顶</span>';
			}
			if(strpos($val['flag'], '2') !== false){
				echo '<span class="yzm-font-style" title="头条">头</span>';
			}
			if(strpos($val['flag'], '3') !== false){
				echo '<span class="yzm-font-style" title="特荐">特</span>';
			}
			if(strpos($val['flag'], '4') !== false){
				echo '<span class="yzm-font-style" title="推荐">推</span>';
			}
			if(strpos($val['flag'], '5') !== false){
				echo '<span class="yzm-font-style" title="热点">热</span>';
			}
			if(strpos($val['flag'], '6') !== false){
				echo '<span class="yzm-font-style" title="幻灯">幻</span>';
			}
			if(strpos($val['flag'], '7') !== false){
				echo '<span class="yzm-font-style" title="跳转">跳</span>';
			}
			if($val['readpoint']){
				echo '<span class="yzm-font-style" title="付费">付</span>';
			}			
			?>	
			</td>
			<td><?php echo get_catname($val['catid']);?></td>
			<td><?php echo date('Y-m-d H:i:s', $val['updatetime'])?></td>
		  </tr>		
		<?php 
		}
		?>
    </tbody>
  </table>
  <?php if(!$data){ ?><div class="yzm_no_data"><i class="yzm-iconfont yzm-iconshuoming"></i> 暂无数据</div><?php } ?>
  <input class="dosubmit w_100 btn-primary radius mt-10" name="dosubmit" type="button" onclick="dosub()" value="确定">
  </form>
  <div id="page"><span class="page_left">共<?php echo $total?>条记录，共<?php echo $page->total()?>页，当前显示第<?php echo $page->getpage()?>页</span>
  <span class="page_right"><?php echo $page->getfull();?></span></div>
</div>
<?php include $this->admin_tpl('footer', 'admin');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/laydate/1.1/laydate.js"></script>
<script type="text/javascript">

	function dosub(){
		var ids = $("input[name='ids[]']:checked");
		if (ids.length<1){
		   layer.msg('请选择文章！', {icon:2});
		   return false;
		}	
		
		var str = '';
		$.each(ids,function(){
			if(this.checked){
				str += $(this).val() + ',';
			}
    });
		str = str.substr(0,str.length-1);
		
		var index = parent.layer.getFrameIndex(window.name);
		parent.$("#relation_id").val(str);
		parent.layer.close(index);
	}

	var start = {elem:'#start',format:'YYYY-MM-DD',min:'1999-01-01',max:'2099-01-01',istime:false,istoday:false,choose:function(datas){end.min = datas;end.start = datas}
	};
	var end = {elem:'#end',format:'YYYY-MM-DD',min:'1999-01-01',max:'2099-01-01',istime:false,istoday:false,choose:function(datas){start.max = datas;}};
	laydate(start);
	laydate(end);
</script> 

</body>
</html>